<template>
  <div class="course-list" @click="$router.push(`/coursedet?id=${itemObj.id}`)">
    <p style="font-size:24px;margin-top:20px">{{itemObj.title}}</p>
    <div style="font-size:12px;color:#777777;margin-top:10px">
      <van-icon name="clock-o" />
      <span>{{time}}</span>|
      <span>{{itemObj.sales_num}}课时</span>
    </div>
    <div class="teacher">
      <img :src="itemObj.teachers_list[0].teacher_avatar" alt />
      <span style="font-size:12px;color:#777777">{{itemObj.teachers_list[0].teacher_name}}</span>
    </div>
    <div class="price">
      <span style="font-size:12px;color:#777777">{{itemObj.brows_num}}已报名</span>
      <span style="font-size:23px;color:#44A426">{{itemObj.underlined_price==0?'免费':itemObj.underlined_price}}</span>
    </div>
  </div>
</template>
<script>
import {ref} from 'vue'
export default {
  props: {
    itemObj: Object
  },
  setup(props) {
    const time = ref('')
    const t=props.itemObj.start_play_date
    time.value = new Date(t*1000).toLocaleString()
    return{time}
  }
};
</script>
<style lang="scss" scoped>
.course-list {
  width: 95%;
  background: #fff;
  border-radius: 5px;
  margin: auto;
  margin-top: 10px;
  box-sizing: border-box;
  padding: 10px;
  .teacher{
    margin-top: 10px;
    img{
        width: 43px;
        height: 43px;
        border-radius: 50%;
        vertical-align: middle;
        margin-right: 15px;
    }
  }
  .price{
    display: flex;
    justify-content: space-between;
    padding: 35px 0;
  }
}
</style>